package com.exercise.ThreadAttribute;

public class ThreadPriorityExample {
    public static void main(String[] args) {
        Thread thread1 = new Thread(() -> System.out.println("Thread1:" + Thread.currentThread().getPriority()));
        Thread thread2 = new Thread(() -> {
            System.out.println("Thread2:" + Thread.currentThread().getPriority());
        });
        //设置最低优先级
        thread1.setPriority(Thread.MIN_PRIORITY);
        //设置最高优先级
        thread2.setPriority(Thread.MAX_PRIORITY);

        thread1.start();
        thread2.start();
    }
}
